home *** CD-ROM | disk | FTP | other *** search
/ s-gikan2.maizuru-ct.ac.jp / s-gikan2.maizuru-ct.ac.jp.zip / s-gikan2.maizuru-ct.ac.jp / pub / ncvc352a_install.exe / {app} / scripts / remove_space.pl < prev    next >
Perl Script  |  2011-06-22  |  402b  |  18 lines

  1. #! /usr/bin/perl
  2.  
  3. #  NCâfü[â^é╠âÅü[âhè╘é╠âXâyü[âXüAâ^âué≡ìφÅ£é╖éΘâXâNâèâvâg  #
  4. #  ex.G90 G40 G80 -> G90G40G80                             #
  5.  
  6. $pre_file= $ARGV[0];
  7. $out_file= $ARGV[1];
  8. open(IN,$pre_file);
  9. open(OUT,">$out_file");
  10.  
  11. while(<IN>){
  12.     if(!/^N?[0-9\s]*[\(\%]/){ $_ =~ s/(\S)\s+(\S)/$1$2/g; }
  13.     elsif(/(N[0-9]+)[\s]*([\(\%])/){ $_= $1.$2.$'; }
  14.     print OUT;
  15. }
  16. close(OUT);
  17. close(IN);
  18.